<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8" />
  <title>text</title>
  <!-- 引入Vue -->
  <script type="text/javascript" src="../../js/vue.js"></script>
</head>

<body>
  <!-- 准备好一个容器-->
  <div id="demo">
    <h2>{{fullName}}</h2>
    <input type="text" placeholder="请输入你的姓" v-model="firstName">
    <hr>
    <input type="text" placeholder="请输入你的名" v-model="lastName">
  </div>
</body>

<script type="text/javascript">
  // 创建Vue实例化 
  var vm = new Vue({
    el: '#demo',
    data() {
      return {
        firstName: '',
        lastName: ''
      }
    },
    // computed: {
    //   info: {

    //   }
    // },
    computed: {
      fullName: {
        get() {
          return this.firstName.slice(0, 1).toUpperCase() + this.firstName.slice(1) + '-' + this.lastName
        },
        set() { }
      }
    }
  })
</script>

</html>